package com.example.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.example.pojo.Order;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Mapper
public interface OrderMapper extends BaseMapper<Order> {

    // 自定义分页查询（用户端和房东端通用）
    IPage<Order> selectByUserOrOwner(@Param("page") IPage<Order> page, @Param("currentUserId") Integer currentUserId,
                                     @Param("role") String role,@Param("status") String status,
                                     @Param("roomName")String roomName);

    // 统计今日订单数
    int countTodayOrders(@Param("ownerId") Integer ownerId, @Param("today")LocalDate today);
    // 统计今日收入
    double sumTodayIncome(@Param("ownerId") Integer ownerId, @Param("today")LocalDate today);

}
